package com.tedu.show.menus;

import com.tedu.controller.GameController;

import javax.swing.*;
import java.awt.*;

public class SelectionScreen extends BaseScreen {
    public SelectionScreen() {
        super("game_start");

        // 单人游戏按钮
        JButton singlePlayerButton = new JButton("单人游戏");
        singlePlayerButton.setBounds(300, 290, 200, 50);
        singlePlayerButton.addActionListener(e -> {
            GameController.isMultiplayerMode = false; // 设置为单人模式
            GameController.switchPanel(GameController.GameState.LEVEL_SELECTION);
        });
        this.add(singlePlayerButton);

        // 多人游戏按钮
        JButton multiPlayerButton = new JButton("多人游戏");
        multiPlayerButton.setBounds(300, 350, 200, 50);
        multiPlayerButton.setEnabled(true);
        multiPlayerButton.addActionListener(e -> {
            GameController.isMultiplayerMode = true; // 设置为双人模式
            GameController.switchPanel(GameController.GameState.LEVEL_SELECTION);
        });
        this.add(multiPlayerButton);

        // 游戏说明按钮
        JButton infoButton = new JButton("游戏说明");
        infoButton.setBounds(300, 410, 200, 50);
        infoButton.addActionListener(e -> GameController.switchPanel(GameController.GameState.INFO));
        this.add(infoButton);

        // 游戏设置按钮
        JButton settingsButton = new JButton("游戏设置");
        settingsButton.setBounds(300, 470, 200, 50);
        settingsButton.addActionListener(e -> GameController.switchPanel(GameController.GameState.SETTINGS));
        this.add(settingsButton);

        // 返回按钮
        JButton backButton = new JButton("返回");
        backButton.setBounds(680, 20, 100, 40);
        backButton.addActionListener(e -> GameController.switchPanel(GameController.GameState.START));
        this.add(backButton);
    }
}
